package com.example.elysiumease.mapper;

import com.example.elysiumease.model.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface UserMapper {
    int insert(User user);
    int update(User user);
    int deleteById(Integer userId);
    User selectById(Integer userId);

    @Update("UPDATE users SET role = #{role} WHERE user_id = #{userId}")
    int updateUserRole(@Param("userId") Integer userId, @Param("role") String role);

    User selectByUsername(@Param("username") String username);

}